﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPivotGrid;
using System.Collections.Generic;
using DXApplicationTangche.UC.成品出库单.service;
using System.Data;
using DXApplicationTangche.Utils;
using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.UC.订单一览新.订单预览新.service;
using DXApplicationTangche.UC.订单一览新.辅料.service;
using DXApplicationTangche.UC.款式尺寸;
using mendian;
using DXApplicationTangche.DTO;
using DXApplicationTangche.UC.货号管理.service;
using DXApplicationTangche.UC.项目流程.Service;
using DXApplicationTangche.UC.订单一览新.销售确认单;

namespace DXApplicationTangche.report
{
    public partial class XtraReport销售订单 : DevExpress.XtraReports.UI.XtraReport
    {
        private CustomerSaleOrderReportDTO customerSaleOrderReportDTO = new CustomerSaleOrderReportDTO();
        private List<CustomerSaleOrderReportDetailDTO> customerSaleOrderReportDetailDTOs = new List<CustomerSaleOrderReportDetailDTO>();

        public XtraReport销售订单(CustomerSaleOrderReportDTO customerSaleOrderReportDTO)
        {
            InitializeComponent();
            this.customerSaleOrderReportDTO = customerSaleOrderReportDTO;
            this.customerSaleOrderReportDetailDTOs = customerSaleOrderReportDTO.customerSaleOrderReportDetailDTOList;
            this.BindData();
            this.BindTableData();
        }
        /// <summary>
        /// 绑定表头
        /// </summary>
        private void BindData()
        {
            this.xrTableCell客户姓名.Text = this.customerSaleOrderReportDTO.customerName;
            this.xrTableCell电话.Text = this.customerSaleOrderReportDTO.mobile;
            this.xrTableCell客户地址.Text = this.customerSaleOrderReportDTO.customerAddress;
            this.xrTableCell账户余额.Text = this.customerSaleOrderReportDTO.accountBalance.ToString();
            this.xrTableCell会员类型.Text = this.customerSaleOrderReportDTO.membershipType;
            if ("柏威年".Equals(this.customerSaleOrderReportDTO.store))
            {
                this.xrTableCell门店地址.Text = "辽宁省大连市中山区中山路129-3号柏威年购物中心四楼L4003-B春衫定制";
            }
            else 
            {
                this.xrTableCell门店地址.Text = "辽宁省大连市中山区长江东路80号凯丹广场二楼49、50号春衫定制";
            }
            //this.xrTableCell门店.Text = this.customerSaleOrderReportDTO.store;
            this.xrTableCell主销售.Text = this.customerSaleOrderReportDTO.assistant;
            this.xrTableCell下单日期.Text = this.customerSaleOrderReportDTO.orderDate;
            this.xrTableCell打印日期.Text = this.customerSaleOrderReportDTO.printDate;
            if ("王闯".Equals(this.customerSaleOrderReportDTO.assistant))
            {
                this.xrTableCell销售电话.Text = "19984103788";
            }
            else if ("宋玲玲".Equals(this.customerSaleOrderReportDTO.assistant))
            {
                this.xrTableCell销售电话.Text = "19984109795";
            }
            else if ("李依妍".Equals(this.customerSaleOrderReportDTO.assistant))
            {
                this.xrTableCell销售电话.Text = "19984109797";
            }
            else if ("李温婷".Equals(this.customerSaleOrderReportDTO.assistant))
            {
                this.xrTableCell销售电话.Text = "19984109794";
            }
            else if ("宋程程".Equals(this.customerSaleOrderReportDTO.assistant))
            {
                this.xrTableCell销售电话.Text = "19984109799";
            }
            else if ("曲佳慧".Equals(this.customerSaleOrderReportDTO.assistant))
            {
                this.xrTableCell销售电话.Text = "13074160337";
            }
            else
            {
                this.xrTableCell销售电话.Text = "19984109792";
            }
        }

        private void BindTableData()
        {
            this.xrTableCell数量.DataBindings.Add("Text", DataSource, "quantity");
            this.xrTableCell款式名称.DataBindings.Add("Text", DataSource, "styleNameCn");
            this.xrTableCell面料名称.DataBindings.Add("Text", DataSource, "materialNameCn");
            this.xrTableCell尺码.DataBindings.Add("Text", DataSource, "styleSizeCd");
            this.xrTableCell服务类型.DataBindings.Add("Text", DataSource, "serviceType");
            this.xrTableCell付款方式.DataBindings.Add("Text", DataSource, "paymentType");
            this.xrTableCell实付价格.DataBindings.Add("Text", DataSource, "actualPay");
        }
    }

}
